package cn.itcast.star.graph.core.controller;

import cn.itcast.star.graph.core.pojo.dto.common.Result;
import cn.itcast.star.graph.core.pojo.dto.request.Text2ImageResDto;
import cn.itcast.star.graph.core.pojo.dto.respone.Text2ImageReqDto;
import cn.itcast.star.graph.core.service.Text2ImageService;
import cn.itcast.star.graph.core.utils.UserUtils;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Windows
 */
@RestController
@RequestMapping("/api/authed/1.0/t2i")
public class ToImageController {
    @Resource
    private Text2ImageService text2ImageService;

    /**
     * 生成图片的接口
     * @param text2ImageResDto
     * @return
     */
    @RequestMapping("/prompt")
    public Result<Text2ImageReqDto> prompt(Text2ImageResDto text2ImageResDto){
        Text2ImageReqDto text2ImageReqDto = text2ImageService.propmt(text2ImageResDto);
        return Result.ok(text2ImageReqDto);
    }
    @PostMapping("/list")
    public String list() {
        System.out.println("用户ID是："+ UserUtils.getUser().getId());
        return "hello";
    }

    }
